package edu.szte.ovrt.datahandler.csv;

import java.io.Writer;

import edu.szte.ovrt.datahandler.core.AbstractDocumentWriter;
import edu.szte.ovrt.datahandler.model.*;

public class CSVWriter extends AbstractDocumentWriter {

	public CSVWriter(final Writer writer) {
		super(writer);
	}

	@Override
	protected void beginDocument(final Document document) {
	// empty
	}

	@Override
	protected void beginSection(final Section section) {
		m_writer.println(section.getName());
	}

	@Override
	protected void endDocument(final Document document) {
	// empty
	}

	@Override
	protected void endSection(final Section section) {
	// empty
	}

	@Override
	protected void write(final Item item) {
		m_writer.println(item.getKey() + ";" + item.getValue());
	}

}
